/*
 * @Descripttion: 
 * @version: V1.0.0
 * @Author: LeonHe
 * @Date: 2021-05-28 12:12:57
 * @LastEditTime: 2021-05-30 16:00:47
 */
#ifndef __PID_CONTROLLER_
#define __PID_CONTROLLER_
#include "arm_math.h"

typedef struct
{
    q15_t ref;
    q15_t fbk;
    q15_t out;
    arm_pid_instance_q15 param;
}pidConQ15StDef;

typedef struct
{
    q31_t ref;
    q31_t fbk;
    q31_t out;
    arm_pid_instance_q31 param;
}pidConQ31StDef;


void PidControllerQ15Func(pidConQ15StDef* inst);
void PidControllerQ31Func(pidConQ31StDef* inst);
#if 1
#define PidControllerQ15(x) do{\
                            PidControllerQ15Func(x);\
                        }while(0)
#define PidControllerQ31(x) do{\
                            PidControllerQ31Func(x);\
                        }while(0)
#else
#define PidControllerQ15(x) do{\
                            (x)->out = arm_pid_q15(&(x)->param, (x)->ref - (x)->fbk);\
                        }while(0)
#endif


#endif
